package com.peanut.youfupay.service.other.invoice;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.QueryInvoiceTypeRequestDTO;
import com.peanut.youfupay.entity.response.QueryInvoiceTypeResponseDTO;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商户查询开票类目
 *
 * @author peanut
 */
@Slf4j
@Service("queryInvoiceTypeService")
public class QueryInvoiceTypeService extends BaseService {
    /**
     * @param funCodeEnum
     * @param queryInvoiceTypeRequestDTO
     * @return
     * @throws Exception
     */
    public List<QueryInvoiceTypeResponseDTO> doBusiness(FunCodeEnum funCodeEnum, QueryInvoiceTypeRequestDTO queryInvoiceTypeRequestDTO) throws Exception {
        log.info("查询开票类目开始:{}，{}", funCodeEnum, queryInvoiceTypeRequestDTO);
         ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, queryInvoiceTypeRequestDTO);
        List<QueryInvoiceTypeResponseDTO> queryInvoiceTypeResponseDTOS = JSON.parseArray(responseMessage.getResData(), QueryInvoiceTypeResponseDTO.class);
        log.info("查询开票类目结束:{}", queryInvoiceTypeResponseDTOS);
        return queryInvoiceTypeResponseDTOS;

    }

}





